package com.lehecai.core.lottery;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

public class GiftCardCondition extends IntegerBeanLabelItem {
	private static final Logger logger = LoggerFactory.getLogger(GiftCardCondition.class.getName());
	private static final long serialVersionUID = 4839923458363953568L;
	
	private static List<GiftCardCondition> items = new ArrayList<GiftCardCondition>();
	private static List<GiftCardCondition> queryItems = new ArrayList<GiftCardCondition>();

	protected GiftCardCondition(String name, int value, boolean queryOnly) {
		super(GiftCardCondition.class.getName(), name, value);
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	protected GiftCardCondition(String name, int value) {
		this(name, value, false);
	}
	
	public static GiftCardCondition getItem(int value){
		try {
			return (GiftCardCondition)GiftCardCondition.getResult(GiftCardCondition.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<GiftCardCondition> getItems() {
		return items;
	}

	public static List<GiftCardCondition> getQueryItems() {
		return queryItems;
	}
	
	public final static GiftCardCondition ALL = new GiftCardCondition("全部", -1, true);
	
	public final static GiftCardCondition UNHANDLING = new GiftCardCondition("无", 0);
	public final static GiftCardCondition CLAIMED = new GiftCardCondition("使用时需要完善个人资料并验证手机号", 1);

}

